package com.example.vocab.service.impl;

import com.example.vocab.dao.UserDao;
import com.example.vocab.entity.User;
import com.example.vocab.service.UserService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public User getUser(User user) {
        User res = userDao.getUser(user);
        return res!=null?res:new User();
    }

    @Override
    public int addUser(User user) {
        int i = userDao.addUser(user);
        return i;
    }

    @Override
    public User selectUser(String username) {
        User us = userDao.selectUser(username);
        return us;

    }

    @Override
    public User selectUserByUid(User user) {
        User i=userDao.selectUserByUid(user);
        return i;
    }
}
